// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 2e5+50;

int t, n;
int cur, h[N];

int main(int argc, char const *argv[]) {
    // code
    scanf("%d", &t);
    for (int kk=0; kk<t; ++kk) {
        int hh;
        scanf("%d%d", &hh, &n);
        for (int i=0; i<n; ++i) {
            scanf("%d", &h[i]);
        }
        h[n++] = 0;
        int cur = h[0];
        int now = 0;
        int ans = 0;
        while (1) {
            while (now < n && h[now] >= cur)
                ++now;
            if (now >= n-1)
                break;
            int a1 = h[now], a2 = h[now+1];
            // dbg(now, cur, a1, a2);
            if (a2 == a1 -1)
                cur = a2;
            else if (a2 < a1 - 1) {
                ++ans;
                cur = a1 - 1;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}
